package edu.gxnu.cetcdemo.controller;

import edu.gxnu.cetcdemo.pojo.Maintain;
import edu.gxnu.cetcdemo.service.MaintainService;
import edu.gxnu.cetcdemo.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/maintain")
public class MaintainController {
    @Autowired
    private MaintainService maintainService;

    @ApiOperation("浏览维修信息列表接口")
    @GetMapping("")
    public Result queryMaintainList(){
        return maintainService.queryMaintainList();
    }

    @ApiOperation("添加维修信息接口")
    @PostMapping("")
    public Result addMaintain(@RequestBody Maintain maintain){
        return maintainService.addMaintain(maintain);
    }

    @ApiOperation("更新维修信息接口")
    @PutMapping("")
    public Result updateMaintain(@RequestBody Maintain maintain){
        return maintainService.updateMaintain(maintain);
    }

    @ApiOperation("删除维修信息接口")
    @DeleteMapping("/{id}")
    public Result delMaintain(@PathVariable long id){
        return maintainService.delMaintain(id);
    }

}
